<?php
	
	include_once('DAOHandler_lib/DAOHandler.php');
	include_once('DAOHandler_lib/ClassBase.php');

	class Usuarios_DAO extends DAOHandler {	

			function __construct() {
				parent::__construct("usuarios");				
			}		

			public function busqueda($criterio){			
			
				$result = array();					
				$conn = $this->getConnection();		

				//  Ejecuta la consulta. 
				$tsql = "SELECT * FROM Usuarios where usuario LIKE '%".$criterio."%'";
				
				$stmt = $this->execute_query( $conn, $tsql,null);
				
				if( $stmt === false)
				{
					 echo "Error en la consulta.";					 
				}

				$i=0;

				// Retorna los datos de la consulta.			
				while( $row = $this->fetch_array( $stmt)){
					
					$result[$i]=$row;
					//echo json_encode($row);
					$i++;
				}

				// Free statement and connection resources. 
				$this->free_stmt( $stmt);
				$this->close( $conn);

				return $result;
			}
	}
?>